<h2 class="title"><?php echo $this->title; ?></h2>
<div class="products">
    <?php if(count($products_by_cats) > 0) : ?>
        <?php foreach($products_by_cats as $cat_id => $products) :?>
            <?php
            $cat = LanguageCategory::model()->find('category_id=:catId AND locale=:locale',array(':catId'=>$cat_id,':locale'=>Yii::app()->language));
            $catTitle = '';
            if (!is_null($cat))
                $catTitle = $cat->title;
            ?>
            <div class="group<?php echo $cat_id; ?> clearfix">
                <h3><?php echo $catTitle; ?></h3>
                <?php foreach($products as $product) : $detailUrl = Yii::app()->createUrl('/Product/default/view',array('cat_id'=>$product->category_id,'locale'=>$product->localeProduct->locale,'id'=>$product->localeProduct->product_id,'alias'=>$product->localeProduct->alias)); ?>
                    <div class="item">
                        <a class="product-image" href="<?php echo $detailUrl; ?>"><img src="<?php echo image_path($product->images); ?>" alt="<?php echo $product->localeProduct->name;?>" /></a>
                        <div class="product-name"><a href="<?php echo $detailUrl; ?>"><?php echo $product->localeProduct->name;?></a></div>
                        <div class="hidden-product-info">
                            <?php if(intval($product->price) > 0) : ?><p><?php echo '<b>'.Yii::t('site/product','Price').' : </b>'.number_format($product->price).' '.$product->currency; ?></p><?php endif; ?>
                            <?php if (trim($product->localeProduct->source)!='') : ?><p><?php echo '<b>'.Yii::t('site/product','Source').' : </b>'.$product->localeProduct->source; ?></p><?php endif; ?>
                            <div><?php echo $product->localeProduct->short_description; ?></div>
                        </div>
                    </div>
                <?php endforeach; ?>
            </div>
        <?php endforeach;?>
    <?php else : ?>
        <p><?php echo $this->emptyText; ?></p>
    <?php endif; ?>
</div>

<script type="text/javascript">
$(document).ready(function(){
    $('.products a.product-image, .products .product-name a').tooltip({
       bodyHandler: function() {
         return $(this).closest('.item').find('.hidden-product-info').html();
       },
       showURL: false
    });
});
</script>